/**
 * JAVACC DEMO 1.0
 * @copy right iussoft company All rights reserved.
 * @Package com.apache.uct.controller  
 */
package com.apache.passport.controller;

import javax.servlet.http.HttpServletRequest;

import com.apache.action.ActionSupport;
import com.apache.api.entity.BaseEntity;
import com.apache.api.vo.ParamsVo;
import com.apache.api.vo.ResultMsg;
import com.apache.passport.entity.UctUser;

/**
 * description:  Action父类
 * @Copyright(c)2014:
 * @param <T>
 */
public abstract class SsoBaseAction<T extends BaseEntity> extends ActionSupport<T> {

	protected ResultMsg getResultMsg(HttpServletRequest request, String msg) {
		request.getSession().setAttribute("formToken", request.getAttribute("formToken"));
		ResultMsg rmsg = new ResultMsg("F", msg);
		return rmsg;
	}

	/**
	 * description:  日志生成调用方法
	 * @param request
	 */
	protected ParamsVo<T> getParamsVo(HttpServletRequest request, UctUser user) {
		ParamsVo<T> params = new ParamsVo<T>();
		if (null == user)
			return params;
		params.setParams("logIp", getUserIp(request));
		params.setLogClassName(getGenType());
		params.setUserEname(user.getUserEname());
		params.setUserId(user.getUserId());
		return params;
	}

}
